package cn.edu.cqvie.jdk8.fun;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

public class OptionalTest2 {

    public static void main(String[] args) {
        Employee employee = new Employee("zhangsan");
        Employee employee1 = new Employee("lisi");

        Company company = new Company();
        company.setName("company1");
        List<Employee> employees = Arrays.asList(employee, employee1);
        company.setEmployees(employees);

        Optional<Company> optional = Optional.ofNullable(company);
        System.out.println(optional.map(c -> c.getEmployees()).orElse(Collections.emptyList()));


    }


    public void test (Optional optional) {

    }
}
